package com.ulife.song.dao.impl;

import java.sql.SQLException;
import java.util.List;

import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

import com.ulife.song.dao.SongDao;
import com.ulife.song.dao.dataobject.SongDO;

public class SongDaoImpl extends SqlMapClientDaoSupport implements SongDao{

	@SuppressWarnings("unchecked")
	public List<SongDO> getAllSong() throws SQLException {
		return getSqlMapClient().queryForList("Song.selectAllSongs");
	}

	public int addSong(SongDO song) throws SQLException {
		return getSqlMapClient().update("Song.insertSong",song);
	}

	public SongDO getSongById(long songId) throws SQLException {
		return (SongDO)getSqlMapClient().queryForObject("Song.getSongById",songId);
	}

	public int updateSong(SongDO song) throws SQLException {
		return getSqlMapClient().update("Song.updateSongInfo", song);
	}

	@SuppressWarnings("unchecked")
	public List<SongDO> querySong(SongDO songDO) throws SQLException {
		return getSqlMapClient().queryForList("Song.querySong", songDO);
	}

}
